-
-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modernize build system and .NET platform targets #3929
Conversation
4f701a6
to
4f0e860
Compare
4f0e860
to
f7f40aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HebaruSan this is super awesome! Yes I'm quite fond of the tools built into VS code, it's really useful for improving quality of life when developing. We could probably also look into adding a workspace file.
I've given this a brief once over, nothing stands out, and all the changes look like sensible enhancements for safety and readability.
It is notable github has a few warnings, but nothing that wasn't there before and probably belong in a separate PR specific to those changes:
'WebClient.WebClient()' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.' (https://aka.ms/dotnet-warnings/SYSLIB0014)
'SHA1CryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' (https://aka.ms/dotnet-warnings/SYSLIB0021)
Thanks, this is a great improvement!
@techman83 good point, it would also be nice to take care of those warnings. (I think they only apply to the .NET 7 builds, so they don't show up for me normally in VSCode). Linking them here for future reference: https://github.com/KSP-CKAN/CKAN/actions/runs/6916657258?pr=3929 |
Motivation
I have been getting deeper into VSCode lately, which has
C#
andC# Dev Kit
extensions that are pretty useful for .NET development. Specifically:Unfortunately these things don't work with CKAN out-of-the-box because VSCode uses
dotnet build
to compile, which fails because we currently rely on an older, incompatible version ofCake
. (Plus various other small obstacles that I stumbled into and worked around in the course of this development.)Changes
bin/ckan-validate.py
was a script that checked whether a.ckan
file conformed toCKAN.schema
. This capability is built-in tonetkan.exe --validate-ckan
as of Migrate Perl validation checks into netkan.exe #2788, and this script hasn't been used in a long time. It was written in an older dialect of Python (see Update old validate script to Python 3 #3432), and hence triggers a lot of linting errors in VSCode. This script is now deleted 👋🪦.bin/ckan-merge-pr.py
...bin/ckan_merge_pr.py
to conform to Python conventionspylint
andmypy
checks that came up in VSCodeminimizeNotifyIcon.Text
(always set to "CKAN" anyway) is removedToHashSet
).Core/Platform.cs
is now replaced with calling that new APIdotnet build
now successfully completes so VSCode can provide warnings/errors and run testsdotnet build
will add an extra property and a reference to work around a bogus compile error, and use a different output path to avoid accidentally packing that reference into the finalckan.exe
(which would make the build fail on Linux)../build
and.\build.ps1
scripts...dotnet tool install
to install a version ofCake.Tool
that corresponds to what VSCode uses instead of installing an ancient Cake with an old Nuget (we still target .NET Framework rather than .NET Core/Standard/whatever-it's-called-this-week, but we now use newer tools to do the build)dotnet cake
instead ofmono Cake.exe
DotNetCore*
inbuild.cake
withDotNet*
due to another backwards incompatible change, this time in Cake itself.vscode/settings.json
file sets the default solution, activates the extension settings that seemed to work best for me, and indicates how to find the tests DLLAutoUpdate
project no longerILRepack
s itself in its.csproj
(because of some obscure problem withdotnet build
that I cannot recall at the moment), but instead isILRepack
ed bybuild.cake
after the repacking ofckan.exe
.editorconfig
file is created to turn code style suggestions into warnings and turn off the ones that are unhelpfulAt the end of all this, we are closer to a modern build system and would have an easier time migrating to future versions of .NET if required or desired. We will also have access to more of the assistive features of VSCode when working in that environment.